Optimal. Leaf size=91 \[ \frac {a \sin (c+d x)}{d \left (a^2+b^2\right )}+\frac {b \cos (c+d x)}{d \left (a^2+b^2\right )}-\frac {b^2 \tanh ^{-1}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.08, antiderivative size = 91, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3100, 2637, 3074, 206} \[ \frac {a \sin (c+d x)}{d \left (a^2+b^2\right )}+\frac {b \cos (c+d x)}{d \left (a^2+b^2\right )}-\frac {b^2 \tanh ^{-1}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 206
Rule 2637
Rule 3074
Rule 3100
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx &=\frac {b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac {a \int \cos (c+d x) \, dx}{a^2+b^2}+\frac {b^2 \int \frac {1}{a \cos (c+d x)+b \sin (c+d x)} \, dx}{a^2+b^2}\\ &=\frac {b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac {a \sin (c+d x)}{\left (a^2+b^2\right ) d}-\frac {b^2 \operatorname {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (c+d x)-a \sin (c+d x)\right )}{\left (a^2+b^2\right ) d}\\ &=-\frac {b^2 \tanh ^{-1}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2} d}+\frac {b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac {a \sin (c+d x)}{\left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.18, size = 79, normalized size = 0.87 \[ \frac {\sqrt {a^2+b^2} (a \sin (c+d x)+b \cos (c+d x))+2 b^2 \tanh ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )-b}{\sqrt {a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.64, size = 187, normalized size = 2.05 \[ \frac {\sqrt {a^{2} + b^{2}} b^{2} \log \left (-\frac {2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right ) + 2 \, {\left (a^{2} b + b^{3}\right )} \cos \left (d x + c\right ) + 2 \, {\left (a^{3} + a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.33, size = 118, normalized size = 1.30 \[ -\frac {\frac {b^{2} \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b\right )}}{{\left (a^{2} + b^{2}\right )} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.16, size = 90, normalized size = 0.99 \[ \frac {-\frac {2 \left (-a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-b \right )}{\left (a^{2}+b^{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {2 b^{2} \arctanh \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.57, size = 142, normalized size = 1.56 \[ -\frac {\frac {b^{2} \log \left (\frac {b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (b + \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}}{a^{2} + b^{2} + \frac {{\left (a^{2} + b^{2}\right )} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.63, size = 110, normalized size = 1.21 \[ \frac {\frac {2\,b}{a^2+b^2}+\frac {2\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a^2+b^2}}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {2\,b^2\,\mathrm {atanh}\left (\frac {a^2\,b+b^3-a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^2+b^2\right )}{{\left (a^2+b^2\right )}^{3/2}}\right )}{d\,{\left (a^2+b^2\right )}^{3/2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________